<?php
/**
 * Author  : DAMMAK Wassim
 * Contact : wdammak@talend.com
 * Date    : 12/2008
 * @copyright talend.com 2008
 * @license GNU/GPL Version 2
 **/
?>
<table width="93%" style="z-index:1001; display:block;" onclick="javascript:cacheGuidelines(true); CacherMasque('cacherTout'); ChangeClassName('table_guide_line1',''); ChangeClassName('table_guide_line2','');" id="guidelines">
	<tr>
		<td width="20%"></td>
		<td>
			<div class="body_guidelines">				
				<?php include_once("body_guidelines.php"); ?>
			</div>			
		</td>
		<td width="20%"></td>
	</tr>
</table>

<script type="text/javascript">
<!--
<?php if($is_visible_guidelines==true) : ?>
	ShowMasque('cacherTout');
	cacheGuidelines(false);	
<?php else : ?>
	cacheGuidelines(true);
	ChangeClassName('table_guide_line1',''); 
	ChangeClassName('table_guide_line2','');
<?php endif; ?>
-->
</script>
<form method="post" name="babili">
	<table width="100%" cellspacing="2" cellpadding="0" id="boardNavigator">
	  <tr>
	   <td>
	  	<!-- global table -->
		<?php getHeaderMod();?>		  
		  <!--Select All Langue-->
		  <table cellpadding="0" cellspacing="0">
		  	<tr>
				<td valign="top" style="white-space:nowrap;padding-top:10px;"><?php /*echo _TARGET;*/?>&nbsp;</td>
				<td colspan="4" style="white-space:nowrap;" valign="top">
									
				<div id="middlebar">
				 <ul class="menu">
				  <li><a onclick="javascript:showlayer('sm_1')"><?php echo _SELECT_LANGUAGES;?></a></li>
				   <ul class="submenu" id="sm_1">
        			<li>
					
					<select name="list_langues" id="list_langues" class="list_langues">
					<?php 
						foreach($_SESSION['langues'] as $langue){
							if($langue->isSelect!=true){
								echo '<option value="'.$langue->short_name.'" style="background:url('.$langue->flag.') no-repeat right; padding-right:20px;" id="'.$langue->flag.'">'
										.$langue->name.
									'</option>';
							}
						}
					?>								
					</select>
					&nbsp;&nbsp;

					<input type="button" name="add_langue" value="Add" onclick="addLangue()" />&nbsp;&nbsp;
					<input type="button" name="refresh_langues" value="Refresh" onclick="check();" /><br />
					
					<table cellpadding="0" cellspacing="0" class="all_selected_langue">
					 <tbody name="all_selected_langue" id="all_selected_langue">					 
					  <?php 
						foreach($tab_langues_view_status as $langue){
							echo '<tr id="cont_div_'.$langue->short_name.'">
									<td>
										<input type="hidden" name="lang[]" value="'.$langue->short_name.'" />											
									</td>
									<td>
										<img src="'.$langue->flag.'" width="16" height="11" />
									</td>
									<td style="width:90px;">
										<span>&nbsp;'.$langue->name.'&nbsp;</span>
									</td>
									<td>
										<input type="button" value="Remove" name="rm_'.$langue->short_name.'" id="rm_'.$langue->short_name.'" onclick="removeLangue(\''.$langue->short_name.'\',\''.$langue->name.'\',\''.$langue->flag.'\');" ';
										if($langue->short_name=="US") echo 'disabled="disabled"';
										echo ' />
									</td>
								 </tr>';
						}
					  ?>
					 </tbody>
					</table>
					
					</li>
					</ul>
				  </ul>
				</div>
				<br />
				<?php 
					//View selected langues
					echo "&nbsp;&nbsp;";
					foreach($tab_langues_view_status as $ln){
						echo '<img src="'.$ln->flag .'" width="16" height="11">&nbsp;&nbsp;';
					}
				?>			
				</td>			
			</tr>
		  </table>		  
		<?php getFooterMod();?>		
		</td>
		<!--End Select All Langue-->
		
		<!--Select Project & Show By Status-->
		<td>
		<?php getHeaderMod();?>						
		   <table cellpadding="0" cellspacing="2">
		   
		   	<!--Select Project-->
			<tr>					 
			  <td><?php echo _PROJECT;?>&nbsp;</td>
			  <td>
				<select id="project" name="project" onchange="check();" style="width:170px;">
					<?php 
						foreach($resultProjects as $project){							
							echo "\n".'<option value="'.$project->id_projet.'"';
							if($_SESSION['project']==$project->id_projet){
								echo "selected";
							}
							echo '>'.trim($project->name)."</option>\n";
						}
					?>
				</select>
			   </td>
			</tr>
			
			<!--Status - Show-->
			<tr> 
			  <td><?php echo _SHOW;?></td>
			  <td>
				<?php 					
					$array_values_show=array('my_translated_label','order_by_date_desc','by_author','order_by_files','empty','translated','validated');
					if(!in_array($_POST['selectShow'],$array_values_show)){
						$all_status="all";
					}
				?>
				<select name="selectShow" onchange="check();">				 
				  <option value="all" <?php echo($_POST['selectShow']=="all" || $all_status=="all")?"selected":'';?>>
					<?php echo _ALL;?>
				  </option>
				  <option value="empty" <?php echo($_POST['selectShow']=="empty" && $all_status!="all")?"selected":'';?>>
					<?php echo _EMPTY?>
				  </option>
				  <option value="translated" <?php echo($_POST['selectShow']=="translated" && $all_status!="all")?"selected":'';?>>
					<?php echo _TRANSLATED?>
				  </option>
				  <option value="validated" <?php echo($_POST['selectShow']=="validated" && $all_status!="all")?"selected":'';?>>
					<?php echo _VALIDATED?>
				  </option>
				  <option value="my_translated_label" <?php echo($_POST['selectShow']=="my_translated_label" && $all_status!="all")?"selected":'';?>>
					<?php echo _TRANSLATED_BY_ME;?>
				  </option>
				  <option value="order_by_date_desc" <?php echo($_POST['selectShow']=="order_by_date_desc" && $all_status!="all")?"selected":'';?>>
					<?php echo _ORDER_BY_DATE_DESC;?>
				  </option>
				  <option value="order_by_files" <?php echo($_POST['selectShow']=="order_by_files" && $all_status!="all")?"selected":'';?>>
					<?php echo _BY_FILE;?>
				  </option>
				  
				  <?php if($_SESSION['groupe']=="admin" || $_SESSION['groupe']=="staff" || $_SESSION['groupe']=="editor"):?>
				   <option value="by_author" id="by_author" <?php echo($_POST['selectShow']=="by_author" && $all_status!="all")?"selected":'';?>>
					<?php echo _BY_AUTHOR;?>
				   </option>
				   <?php endif; ?>
				</select>
				<input type="hidden" name="old_show" value="<?php echo $_POST['selectShow']; ?>" />
				
			  </td>
			 </tr>
			 <?php /*
			 <!--
			 <tr>
			   <td>
			   	Translated&nbsp;&nbsp;
			   </td>			   
			   <td>
			   	<input type="radio" name="translaed_opt" value="by_me" <?php if($_POST['translaed_opt']=='by_me') echo 'checked="checked"'; ?> onclick="check();" />&nbsp;By me&nbsp;&nbsp;
				<input type="radio" name="translaed_opt" value="all_user" <?php if(!isset($_POST['translaed_opt']) || $_POST['translaed_opt']=='all_user') echo 'checked="checked"'; ?> onclick="check();" />&nbsp;All users
			   </td>
			 </tr>
			 
			 <tr>
			   <td>
			   	Order By&nbsp;&nbsp;
			   </td>			   
			   <td>
			   	
			   	<input type="radio" name="translaed_opt" value="asc" <?php if($_POST['order_opt']=='asc') echo 'checked="checked"'; ?> onclick="check();" />&nbsp;Date ASC&nbsp;&nbsp;
				<input type="radio" name="translaed_opt" value="desc" <?php if(!isset($_POST['order_opt']) || $_POST['translaed_opt']=='desc') echo 'checked="checked"'; ?> onclick="check();" />&nbsp;Date DESC
			   </td>
			 </tr>
			 -->
			 */
			 ?>
			 
			 <!--Select By File-->
			 <tr>
			  	<td colspan="5">
					<select name="selected_file" id="selected_file" onchange="check();" class="<?php 
							if($_POST['selectShow']=='order_by_files'){
								echo '';
							}else{
								echo 'cachediv';
							}
							?>" >
						<option value="-1" style="height:14px;">None</option>
					  <?php 
						foreach($resultFiles as $item){
							echo '<option value="'.$item->id_file.'" ';
							echo($_POST['selected_file']==$item->id_file)?"selected":'';
							echo '>'.$item->path."\\".$item->name;						
							echo '</option>';
						}
					  ?>
					</select>
					<input type="hidden" name="old_selected_file" value="<?php echo $_POST['selected_file'];?>" />
			  	</td>
			 </tr>
			
			<!--Select By Author-->
			<?php if($_SESSION['groupe']=="admin" || $_SESSION['groupe']=="staff" || $_SESSION['groupe']=="editor"): ?>
			<tr>
				<td colspan="5">
					<select name="translated_by_user" onchange="check();" class="<?php if($_POST['selectShow']=='by_author')echo ''; else echo 'cachediv';?>" id="translated_by_user">
						<option value="-1">None</option>
					  <?php 
						//echo 
						foreach($resultListUsers as $key => $item){
							echo '<option value="'.$item['key'].'" ';
							echo($_POST['translated_by_user']==$item['key'])?"selected":'';
							echo '>'.$item['email']." - ".$item['total']." - ";
							foreach($item as $key_lang => $lang_user){
								if($key_lang!='email' && $key_lang!='total' && $key_lang!='key'){
									echo $key_lang."(".$lang_user.') ';	
								}	
							}
							echo '</option>';
							
						}
					  ?>
					</select>
				</td>
			</tr>
			<?php endif; ?>
			  
		  </table>	
		<?php getFooterMod();?>		
		</td>
		<!--End Select Project & Show By Status-->
				
		
		<!--Box Search -->
		<td>
		  <!-- Search -->
		  <?php getHeaderMod();?>			  
		   <fieldset title="<?php echo str_replace(":","",_SEARCH);?>" style="border:0;">			   
			 <legend align="top"> <strong><?php echo str_replace(":","",_SEARCH);?></strong> </legend>			   
			  <table border="0" cellpadding="0" cellspacing="0">
			   <tr>
				<td valign="top">
				  <fieldset title="<?php echo str_replace(":","",_BY_WORDS);?>" style="height:55px;">
					<legend align="top"> <?php echo _BY_WORDS;?> </legend>
					<input type="text" name="search_key" id="search_key" size="43" value="<?php echo $_POST['search_key']; ?>" />
					 <br />	
					<input type="radio" name="search_option" value="any" id="search_option_any" checked="checked"/><?php echo _ANY_WORD;?>&nbsp;					
					<input type="radio" name="search_option" value="exactly" <?php if(isset($_POST['search_option']) && $_POST['search_option']=="exactly") echo 'checked="checked"'; ?> /><?php echo _EXACTLY;?>&nbsp;
					<input type="radio" name="search_option" value="begin" <?php if(isset($_POST['search_option']) && $_POST['search_option']=="begin") echo 'checked="checked"'; ?> /><?php echo _BEGIN;?>&nbsp;
					<input type="radio" name="search_option" value="end" <?php if(isset($_POST['search_option']) && $_POST['search_option']=="end") echo 'checked="checked"'; ?> /><?php echo _END;?>&nbsp;
					<input type="radio" name="search_option" value="bykey" <?php if(isset($_POST['search_option']) && $_POST['search_option']=="bykey") echo 'checked="checked"'; ?> /><?php echo _KEY;?>&nbsp;					
				  </fieldset>
			  </td>
			  
			  <td valign="top">
				  <fieldset title="<?php echo str_replace(":","",_BY_DATE);?>" style="height:55px;" >
					<legend align=top> <?php echo str_replace(":","",_BY_DATE);?> (yyyy-mm-dd): </legend>
					<table cellpadding="0" cellspacing="0" border="0" style="margin-bottom:2px;">
					  <tr>
						<td>
							<input type="text" name="begindate" id="begindate" value="<?php echo $_POST['begindate']; ?>" size="10"/>
							<br />Begin date				
						</td>
						<td>&nbsp;</td>
						<td>							
							<input type="text" name="enddate" id="enddate" value="<?php echo $_POST['enddate']; ?>" size="10"/>
							<br />End date
						</td>
					  </tr>							
					</table>
				  </fieldset>
			   </td>
			   <td>	
			   	<p class="s_go" align="center">&nbsp;&nbsp;
					<input type="submit" name="search" value="<?php echo _GO?>"/>
			  	</p>
			   </td>
			  </tr>
			 </table>
			</fieldset>			 	
		  <?php getFooterMod();?>
 		 <!-- End Search -->  	
		
		</td>
	  </tr>
	</table>
	<!--End Board navigator--> 
	 
	 
 <!-- Partie au milieu -->
	<input type="hidden" name="item_select" id="item_select" value="<?php echo $_SESSION['item_select']; ?>" />
	<input type="hidden" name="group_user" id="group_user" value="<?php echo $_SESSION['groupe']; ?>" />
	
<!-- global table -->
<table border="0" cellspacing="0" cellpadding="0" id="two_col" width="100%">	
  <tr> 
	<td valign="top" class="keys" id="col_left" align="left"> 
	
		<!--Tools Navigator-->
		<?php if(count($resultTransFinale)>0) :  ?>
		<div id="cont_toolsShow">
		 <div class="box_module" id="toolsShow">
		  <table class="navigator_keys" border="0" cellpadding="0" cellspacing="0" width="100%">
		   <tr>
		  	<td>
				<input type="image" name="first" src="img/resultset_first.png" />
				<input type="image" name="prev" src="img/resultset_previous.png" />
				<?php echo _PAGE;?> <?php echo $_SESSION['num_page'];?>/<label id="nbr_max_pages"><?php echo $nbrPages; ?></label> 
				<input type="image" name="next" src="img/resultset_next.png" />
				<input type="image" name="last" src="img/resultset_last.png" />
			</td>
			<td>
				&nbsp;&nbsp;<?php echo _SHOW;?> 
				<input type="text" name="textShow"  id="textShow" size="5" value="<?php echo $_SESSION['textShow'];?>"/>&nbsp;
				<?php echo _LINES;?> / <?php echo _PAGE;?>&nbsp;&nbsp;
				<input type="hidden" name="old_textShow" value="<?php echo $_SESSION['textShow'];?>" />
			</td>
			<td>
				&nbsp;&nbsp;<?php echo _GOTO;?>&nbsp;<?php echo _PAGE;?>&nbsp;
				<select name="selectPage" id="selectPage" onchange="submit();">
				<?php for($t=1; $t<=$nbrPages; $t++){
						echo "<option"; 
						if($t==$_SESSION['num_page']){
							echo " "._SELECTED;
						}
						echo ">$t</option>";
					}
				?>
				</select>&nbsp;&nbsp;
			</td>
			<td style="border-right-color:#EEE">			
				&nbsp;&nbsp;<?php echo _KEY?> #&nbsp;<input type="text" name="goKeyNum" size="5" onkeyup="format(this)"/>
				<input type="submit" name="goKey" value="<?php echo _GO?>"/>&nbsp;&nbsp;
			</td>
		   </tr>
		  </table>
		 </div>
		</div>
		<?php endif; ?> 
		
		  <!--List Keys + Translations US -->
		  <table class="box_module_table" width="550" id="listKeys">
			<thead class="header_table"> 
			  <td class="cell_one_head">#</td>
			  <td width="180"><?php echo _KEY;?></td>
			  <td width="250">
			  	<?php echo _STRING?>&nbsp;<?php echo '<img src="'.$_SESSION['refLang']->flag.'" width="16" height="11" />';?>
			  </td>
			  <?php 														
				foreach($tab_langues_view_status as $ln){
					echo '<td class="end_col">
							<img src="'.$ln->flag .'" width="16" height="11">
						  </td>';
				}
		 	  ?>
			</thead>
			<tbody>
			<?php 				
				//Initialiser le num de Key en fonction de la page 				
				$j=($_SESSION['num_page']-1)*$_SESSION['textShow']+1;
				$i=0;
				if(count($resultTransFinale)>0){
					foreach($resultTransFinale as $ln){	
						if($i==0){
							echo '<tr id="'.$j.'" onclick="javascript:selectItem(\''.$ln->id_key.'\',\''.$j.'\',\''.$_SESSION['item_select'].'\');" class="';
							if($j==$_SESSION['item_select']){
								echo "cell_on";
							}else{
								echo ($j%2)?"row0":"row1";
							}
							echo '">
									<td class="cell_one">'.$j++.'</td>';
							echo   '<td>'.str_replace("<","&lt;",stripslashes($ln->key_name)).'</td>
									<td id="trans_tab_'.$j.'">'.str_replace("<","&lt;",stripslashes($ln->translation)).'</td>';							
							$i++;
						}						
						
						echo getFlagStatus($ln->id_status,$ln->id_lang,"tab",$ln->id_key);
										
						if($i==$nbr_langues){
							echo '</tr>';
							$i=0;
						}elseif($i!=0){
							$i++;
						}		
					}
				}else{
					echo '<tr><td colspan="'.(count($tab_langues_view_status)+3).'"><span class="noresults">Not found.</span></td></tr>';
				}						
			?>
			</tbody>	 
		  </table>
		  
		  <!--Tools Navigator-->
		  <?php if(count($resultTransFinale)>0) :  ?>
			<div id="cont_toolsShow2">
			 <div class="box_module" id="toolsShow2">
			  <table class="navigator_keys" border="0" cellpadding="0" cellspacing="0" width="100%">
			   <tr>
				<td>
					<input type="image" name="first" src="img/resultset_first.png" />
					<input type="image" name="prev" src="img/resultset_previous.png" />
					<?php echo _PAGE;?> <?php echo $_SESSION['num_page'];?>/<label id="nbr_max_pages"><?php echo $nbrPages; ?></label> 
					<input type="image" name="next" src="img/resultset_next.png" />
					<input type="image" name="last" src="img/resultset_last.png" />
				</td>
				
				<td>
					&nbsp;&nbsp;<?php echo _GOTO;?>&nbsp;<?php echo _PAGE;?>&nbsp;
					<select name="selectPage" id="selectPage" onchange="submit();">
					<?php for($t=1; $t<=$nbrPages; $t++){
							echo "<option"; 
							if($t==$_SESSION['num_page']){
								echo " "._SELECTED;
							}
							echo ">$t</option>";
						}
					?>
					</select>&nbsp;&nbsp;
				</td>
				<td style="border-right-color:#EEE">			
					&nbsp;&nbsp;<?php echo _KEY?> #&nbsp;<input type="text" name="goKeyNum" size="5" onkeyup="format(this)"/>
					<input type="submit" name="goKey" value="<?php echo _GO?>"/>&nbsp;&nbsp;
				</td>
			   </tr>
			  </table>
			 </div>
			</div>
		  <?php endif; ?> 
		
		  <input type="hidden" name="max_words" id="max_words" value="<?php echo $j; ?>" />	
		  	  		  
	  </td>	  
	  <!-- End Navigator -->
	  
	  <!--Sep-->
	  <td class="tdsep">&nbsp;</td>
	  <!--End Sep-->
	  
	  </td>
	
	  <!-- Clonne droite -->
	  <td valign="top" id="col_right">
		
		<?php $file_desc=explode('{desc}',$line_selected[0][2]); ?>
		  <table cellspacing="0" class="box_module_table" width="350" id="ln_translations">
			<tr class="header_table" > 
			  <td colspan="3" class="cell_one_head" width="350"> 				
				<p style="margin:1px; text-align:left;">
					<?php echo _KEY?>: <b id="lbl_key_name"><?php echo $line_selected[0][0];?></b> (#<label id="index_key"><?php echo $_SESSION['item_select']; ?></label>)<br />				
				  	<?php echo _FROM?>: <i><span id="file_name"><?php echo stripslashes($file_desc[0]); ?></span></i>&nbsp;<?php echo _FILE?>
					<div id="file_desc" class="<?php if($file_desc[1]=='')echo 'cachediv';?>" align="left">
						<?php echo _DESCRIPTION;?>&nbsp;<span id="desc_file"><?php echo $file_desc[1]?></span>
					</div>
				</p>
			  </td>
			</tr>

<?php if(count($resultTransFinale)>0) :  ?>				
<?php			
		//$ln=>
		/*Array
		(
			key Anglais
			[0] => Supports Statement Pooling
			status
			[1] => 2
			id_lang
			[2] => 1
			id_key
			[3] => 1
			//Translated By 
			[4] => wdammak@talend.com
			//Edited By
			[5] => 
		)*/
		
		//Edit-Save Words
		//afficher les zones edition
		
		$i=0;
		
		if(count($line_selected)>0){
		
			$my_email=$auth->getIdentity();
			echo '<script type="text/javascript">
					var my_email="'.$my_email.'";
				 </script>';
				 
			foreach($line_selected as $ln){
				if($i==0){
					$info=$ln;
				}else{
					//IF Status=2=validated
					if($ln[1]==2){
						$classTxt="class=\"cachediv\"";
						$classMax="class=\"maxLenghtValide\"";
						$classLbl="";
					}else{
						$classLbl="class=\"cachediv\"";
						if(strlen(stripslashes($ln[0]))>$info[1]){
							$classMax="class=\"maxLenghtNotValide\"";
						}else{
							$classMax="class=\"maxLenghtValideOK\"";
						}
						$classTxt="";
					}				
											
					echo '<tr height="110" class="';
					echo ($i%2)?"row1":"row0";
					
					//Flag langue
					echo '">
						  <td class="cell_one">
						  	<img id="img_flag_'.$ln[2].'" src="'.getSrcFlag($ln[2]).'" width="16" height="11" />
						  </td>';
					
					//Logo status word
					echo '<td align="center" width="80">';
							
				
				###############
				# Panel Tools #
				###############
					
				 ###
				 # Admin groupe
				 ###
					if($_SESSION['groupe']=="admin"){ //All buttons
						
						$classEditMyLabel="class=\"cachediv\"";
						
						//IF status = 1 = $ln[1]
						if($ln[1]==1){
							$classFlagStatus="class=\"cachediv\"";
							$classBtnFlagStatus="";	
						}else{
							$classFlagStatus="";
							$classBtnFlagStatus="class=\"cachediv\"";
						}

						//IF Status = 2 = validated => Button Cancel
						if($ln[1]==2){
							$classBtnCancel="";
						}else{
							$classBtnCancel="class=\"cachediv\"";	
						}
						
						//On cache le bouton Status Flag pour ne pas tromper le staff avec l'icon d'edition
						echo '
							<p id="img_status_cont_'.$ln[2].'" '.$classFlagStatus.'>
								<img id="img_status_'.$ln[2].'" src="'.getSrcLogoStatus($ln[1]).'" width="16" height="16" />
							</p>
							
							<p id="edit_my_item_'.$ln[2].'" '.$classEditMyLabel.'>
							
								<input id="btn_refused_'.$ln[2].'" type="submit" name="refusedWord" value="'._EDIT.'" onclick="editTranslated(\''.$ln[2].'\'); return false;" />
								
						  	</p>
							
							<p id="btn_validate_refused_'.$ln[2].'" '.$classBtnFlagStatus.'>
							
								<input id="btn_validate_'.$ln[2].'" type="submit" name="validateWord" value="'._VALIDATE.'" onclick="validateTransWord(\'validate\',\''.$ln[2].'\'); return false;" />					
							
								<br />
							
								<input id="btn_refused_'.$ln[2].'" type="submit" name="refusedWord" value="'._EDIT.'" onclick="editTranslated(\''.$ln[2].'\'); return false;" />
							
								<br />
							
								<input id="btn_reject_'.$ln[2].'" type="submit" name="rejectWord" value="'._REJECT.'" onclick="validateTransWord(\'reject\',\''.$ln[2].'\'); return false;" />
								
						 	</p>
							
							<p '.$classBtnCancel.' id="btn_reset_'.$ln[2].'">
							
								<input type="submit" name="resetWord" value="'._RESET.'" onclick="validateTransWord(\'reset\',\''.$ln[2].'\'); return false;" />
								
						  	</p>';
					
				 ###
				 # Staff groupe
				 ###
					}elseif($_SESSION['groupe']=="staff"){
						
						$classEditMyLabel="class=\"cachediv\"";
						
						//IF status = 1 = $ln[1]
						if($ln[1]==1){
							$classFlagStatus="class=\"cachediv\"";
							$classBtnFlagStatus="";	
						}else{
							$classFlagStatus="";
							$classBtnFlagStatus="class=\"cachediv\"";
						}
						
						//IF Status = 2 = validated and is not english => Button Cancel
						if($ln[1]==2){
							$classBtnCancel="";
						}else{
							$classBtnCancel="class=\"cachediv\"";	
						}
						
						echo '
							<p id="img_status_cont_'.$ln[2].'" '.$classFlagStatus.'>
								<img id="img_status_'.$ln[2].'" src="'.getSrcLogoStatus($ln[1]).'" width="16" height="16" />
							</p>
							
							<p id="edit_my_item_'.$ln[2].'" '.$classEditMyLabel.'>
								<input id="btn_refused_'.$ln[2].'" type="submit" name="refusedWord" value="'._EDIT.'" onclick="editTranslated(\''.$ln[2].'\'); return false;" />
						  	</p>
							
							<p id="btn_validate_refused_'.$ln[2].'" '.$classBtnFlagStatus.'>
							
								<input id="btn_validate_'.$ln[2].'" type="submit" name="validateWord" value="'._VALIDATE.'" onclick="validateTransWord(\'validate\',\''.$ln[2].'\'); return false;" />					
							
								<br />
							
								<input id="btn_refused_'.$ln[2].'" type="submit" name="refusedWord" value="'._EDIT.'" onclick="editTranslated(\''.$ln[2].'\'); return false;" />
							
								<br />
							
								<input id="btn_reject_'.$ln[2].'" type="submit" name="rejectWord" value="'._REJECT.'" onclick="validateTransWord(\'reject\',\''.$ln[2].'\'); return false;" />
								
						 	</p>
							
							<p '.$classBtnCancel.' id="btn_reset_'.$ln[2].'">
								<input type="submit" name="resetWord" value="'._RESET.'" onclick="validateTransWord(\'reset\',\''.$ln[2].'\'); return false;" />
						  	</p>
							';
					
				 ###
				 # Guest user	
				 ###
					}else{
					
						$classFlagStatus="";
						$classBtnFlagStatus="class=\"cachediv\"";
						$classBtnCancel="class=\"cachediv\"";
						
						//IF Translated By Me = $ln[4] = $my_email
						if(($ln[4]==$my_email || $ln[5]== $my_email) && $ln[1]==1 ){
							$classEditMyLabel="";
						}else{
							$classEditMyLabel="class=\"cachediv\"";
						}
						
						if(($ln[4]==$my_email || $ln[5]== $my_email) && $ln[1]==1){
							$classEditMyLabel="";
						}else{
							$classEditMyLabel="class=\"cachediv\"";
						}
					
						echo '
							<p id="img_status_cont_'.$ln[2].'" '.$classFlagStatus.'>
								<img id="img_status_'.$ln[2].'" src="'.getSrcLogoStatus($ln[1]).'" width="16" height="16" />
							</p>
							
							<p id="edit_my_item_'.$ln[2].'" '.$classEditMyLabel.'>
								<input id="btn_refused_'.$ln[2].'" type="submit" name="refusedWord" value="'._EDIT.'" onclick="editTranslated(\''.$ln[2].'\'); return false;" />
						  	</p>';
					
					}
					
					echo '</td>';						
					
					//Traduction
					echo '<td width="345">
							<p id="cont_txt_'.$ln[2].'" '.$classTxt.'>
								<textarea id="txt_trans_'.$ln[2].'" name="textfield'.$ln[2].'" cols="40"';
					if($ln[1]==1){
						echo ' disabled="disabled"';
					}
					
					if($ln[1]<1 && $ln[2]==1 && $_SESSION['groupe']!="staff" && $_SESSION['groupe']!="admin"){
						$classBtnSave="cachediv";
					}
					
					echo 'onkeyup="changeNbrChars(\''.$ln[2].'\', \'0\');return false;" ondblclick="selectAll(\'txt_trans_'.$ln[2].'\');">'.str_replace("<","&lt;",stripslashes($ln[0])).'</textarea>
								<br />
								<input type="image" onclick="selectAll(\'txt_trans_'.$ln[2].'\');return false" src="img/copy.jpg" title="Copy to Clipboard" valign="top" />
							</p>
							<p id="lbl_trans_'.$ln[2].'" '.$classLbl.'>'.str_replace("<","&lt;",stripslashes($ln[0])).'</p>
							<p id="lbl_max_'.$ln[2].'" '.$classMax.'>'._LENGTH.': '.strlen(stripslashes($ln[0])).' chars</p>';
					//if($ln[1]==0)
						
						//Note
						echo '<p id="lbl_trans_alert_'.$ln[2].'" class="cachediv" style="font-size:9px;color:red;">
								* Try to respect the character length of the source language when possible. 
								The red color is only indicative, you can still save your translation.
							  </p>';	
					
					//Translated By
					echo '<p class="trans_by" id="lbl_trans_by_'.$ln[2].'" class="';
					if($ln[1]!=2 && $ln[4]!=""){
						echo ""; 
					}else{ 
						echo "cachediv"; 
					}
					echo '">By '.$ln[4];
					
					//Edited By
					if($ln[5]!=''){
						echo ", Edited by ".$ln[5];
					}
					echo '</p>';
					
					echo '</td>
					</tr>';							
				}
				$i++;		
			}
			}			
						
		?>
<?php endif; ?>
		  </table>	
<?php 
	//Checked Without Propagation
	//Bouton Save
	//Previous Key
	//Next Key	
	if(count($resultTransFinale)>0):?>	
		<p>
		  	<?php if(isset($_POST['without_group']) && $_POST['without_group']=="on"): ?>
				<input type="checkbox" name="without_propagation" id="without_propagation" checked="checked" />
				<?php echo _WITHOUT_PROPAGATION;?>&nbsp;&nbsp;
			<?php endif;?>
			
			<input type="submit" id="saveTranslation" name="saveTranslation" value="<?php echo _SAVE;?>" 
					onclick="saveTransWord('update');return false;" class="<?php echo $classBtnSave;?>" />
			
			&nbsp;&nbsp;&nbsp;&nbsp; 
			
			<input type="image" src="img/resultset_previous.png" width="16" height="16" name="nextWord" 
					onclick="setPrevItem();return false;" />
			
			<a href="" onclick="setPrevItem();return false;"><?php echo _PREVIOUS;?></a>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href="" onclick="setNextItem();return false;"><?php echo _NEXT;?></a> 
			
			<input type="image" src="img/resultset_next.png" width="16" height="16" name="prevWord" 
					onclick="setNextItem();return false;" />
		</p>
<?php endif; ?>
		</td>
	  </tr>
	</table>
</form>
<div class="clr"></div>
<br />